#include<iostream>
#include<string>
using namespace std;
int ret = -0x3f3f3f3f;
const int N = 1e3 + 10;
int c[N];
int len(int x)
{
    return (to_string(x)).size();
}
int get(int x)
{
    int cnt = 0;
    int sum = 1;
    while (len(x) != 1)
    {
        while (x)
        {
            sum *= x % 10;
            x/= 10;
        }
        x = sum;
        sum = 1;
        cnt++;
    }
    return cnt;
}
int main()
{
    int a, b; cin >> a >> b;
    for (int i = a; i <= b; i++)
    {
        ret = max(ret, c[i - a] = get(i));
    }
    cout << ret << endl;
    string tmp;
    for (int i = a; i <= b; i++)
    {
        if (c[i - a] == ret) tmp += to_string(i) + " ";
    }
    tmp.pop_back();
    cout << tmp;
    return 0;
}